 <link href="<?= STATICURL; ?>css/bootstrap.min.css" rel="stylesheet" />
    <link id="bootstrap-rtl-link" href="" rel="stylesheet" />
    <link href="<?= STATICURL; ?>css/font-awesome.min.css" rel="stylesheet" />
    <link href="<?= STATICURL; ?>css/weather-icons.min.css" rel="stylesheet" />
    <!--Fonts-->
    <link href="http://fonts.useso.com/css?family=Open+Sans:300italic,400italic,600italic,700italic,400,600,700,300" rel="stylesheet" type="text/css">
    <!--Beyond styles-->
    <link id="beyond-link" href="<?= STATICURL; ?>css/beyond.min.css" rel="stylesheet" type="text/css" />
    <link href="<?= STATICURL; ?>css/demo.min.css" rel="stylesheet" />
    <link href="<?= STATICURL; ?>css/typicons.min.css" rel="stylesheet" />
    <link href="<?= STATICURL; ?>css/animate.min.css" rel="stylesheet" />
    <link id="skin-link" href="" rel="stylesheet" type="text/css" />
    <div class="page-content">
        <div class="page-body">
            <div id="horizontal-form">
                    <form class="form-horizontal" role="form">
                       
                        <div class="row">
                            <div class="col-md-7">
                                <input class="form-control js_name" type="text"  p_level="<?=$cat_row['p_level']?>" value="<?=$cat_row['cat_name']?>" placeholder="请输入分类名称">
                                <div class="horizontal-space"></div>
                            </div>
                        </div>
                        <div class="row">
                            <div class="col-md-7">
                                <input maxlength=3 placeholder="排序 默认0" class="form-control js_order" type="text" value="<?=$cat_row['sort_order']?>" />
                                <div class="horizontal-space"></div>
                            </div>
                        </div>
                        <div class="horizontal-space"></div>
                        <div style="clear: both">
                            <span id="js_submit" class="btn btn-default">修 改</span>
                        </div>
                    </form>
                </div>
        </div>
<script src="<?php echo STATICURL; ?>js/jquery-2.0.3.min.js"></script>
<script src="<?php echo STATICURL; ?>js/bootstrap.min.js"></script>
<script src="<?php echo STATICURL; ?>layer/layer.js"></script>
<?php require_once ADMINVIEWPATH.'admin_footer.php'; ?>

<script>
  $(document).ready(function(){
    	var default_order = "<?=$cat_row['sort_order']?>";
		$(".js_order").bind({
				keyup:function(){
					 var txt = $('.js_order').val();
					 var reg = /^[\d]+$/;
					 if(!reg.test(txt) ){
					 		$(this).val('');
					 }
				},
				focus:function(){
		 			if ($(this).val() == 0){
		 				$(this).val('');
		 			}
				},
				blur:function(){
		 			if ($(this).val() == ''){
		 				$(this).val(default_order);
		 			}		 			
				}
		});  

 		$("#js_submit").click(function(){
 			if ($(".js_name").val() == ""){
 				layer.msg("请输入分类名称");
 				$(".js_name").focus();
 				return;
 			}
			$.post("/luckydog/category/do_edit", {cat_name:$(".js_name").val(),sort_order:$(".js_order").val()}, function(data) {				
				if (data.status) {
					layer.msg(data.message);
					window.parent.location.reload();
				}else{
					layer.msg(data.message);
				}
			}, "json");
 		});
	});
</script>


